package com.example.k8s.hello.bean.sys.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 菜单管理
 *
 * @author Mark sunlightcs@gmail.com
 */
@Data
@Accessors(chain = true)
@TableName("sys_menu")
@Schema(description = "菜单管理")
public class SysMenuEntity implements Serializable,Comparable<SysMenuEntity> {
	private static final long serialVersionUID = 1L;
	
	@TableId
	@Schema(description = "菜单ID")
	private Long menuId;

	@Schema(description = "父菜单ID，一级菜单为0")
	private Long parentId;
	
	@TableField(exist=false)
	@Schema(description = "父菜单名称")
	private String parentName;

	@Schema(description = "菜单名称")
	private String name;

	@Schema(description = "菜单URL")
	private String url;

	@Schema(description = "授权(多个用逗号分隔，如：user:list,user:create)")
	private String perms;

	@Schema(description = "类型     0：目录   1：菜单   2：按钮")
	private Integer type;

	@Schema(description = "菜单图标")
	private String icon;

	@Schema(description = "排序")
	private Integer orderNum;
	
	@Schema(description = "ztree属性")
	@TableField(exist=false)
	private Boolean open;

	@TableField(exist=false)
	@Schema(description = "子菜单列表")
	private List<SysMenuEntity> list = new ArrayList<>();

	@Override
	public int compareTo(SysMenuEntity o) {
		return this.getOrderNum()-o.getOrderNum();
	}
}
